home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / utilities / guide / wb-makeinfo.lha / WB-MakeInfo / Rexx / MGuideErr.ced next >
Encoding:
Text File  |  1994-11-28  |  3.7 KB  |  143 lines

  1. /************************************************************************
  2.  * AREXX Script
  3.  *
  4.  * MGuideErr.ced                    Copyright (c) 1993, Gerhard Leibrock
  5.  *
  6.  *                          Derived from:
  7.  * NextError.ced                    Copyright (c) 1989, Peter Cherna
  8.  *
  9.  * ARexx program that scans the MakeGuide error file put out by the MakeGuide
  10.  * Version 1.55 document maker (In conjunction with my WB-Interface).
  11.  * ------------
  12.  * Version $VER: MakeGuide.ced 1.00 by Gerhard Leibrock (Oct 7, 1993)
  13.  *
  14.  * WARNING:
  15.  *         ONLY WORKS FOR PRODUCING .guide FILES !!!!
  16.  *         USELESS FOR PRODUCING .doc OR .dvi FILES !!
  17.  * HINT:
  18.  *         USE MY MakeGuide Workbench Package (WBMGv_vv.lha)
  19.  *         (v.vv -> Version Indicator)
  20.  *
  21.  * ONLY WORKS WITH CYGNUS ED PROFESSIONAL AND AREXX !!
  22.  *
  23.  * Gerhard Leibrock, Neuh"auselerstr. 12, 66459 Kirkel, Germany
  24.  * leibrock@fsinfo.cs.uni-sb.de
  25.  ************************************************************************/
  26.  
  27.  
  28.  
  29. /* Allow CygnusEd to pass status variables */
  30. options results
  31.  
  32. /* Tell ARexx to talk to CygnusEd */
  33. address 'rexx_ced'
  34.  
  35. cr = '0A'X
  36.  
  37. status 20 /* get only the file's path */
  38. path = RESULT
  39. IF RIGHT(path,1)~='/' & RIGHT(path,1)~=':' THEN path=path||'/'
  40. path = path || "MakeGuide.err"
  41. if open('errfile', path) then
  42. DO
  43.   offset = 0
  44.     offset = seek('errfile',offset,'B')
  45.     errorstr = readln('errfile')
  46.     offset = seek('errfile',0,'C')
  47.  
  48.     done = 0
  49.     DO until done = 1
  50.     parse var errorstr txt '®'
  51.         if (length(errorstr) > 1) & ( txt ~= 'Making AmigaGuide') then
  52.         DO    
  53.       /*  For MakeGuide the error file contains lines of the following
  54.           form:
  55.           ``filename:line:errmsg.explanation''
  56.               where filename is the name of the source module, line
  57.           is the line number of the error, errmsg is the error message
  58.           and explanation explains the error causing item.
  59.       */
  60.  
  61.             parse var errorstr root ':' file ':' line ':' errmsg
  62.  
  63.             /*    Check if file's name had no colon.  True if errmsg if empty. */
  64.  
  65.             if (length(errmsg) = 0) then
  66.             DO
  67.                 root = ''
  68.                 parse var errorstr file ':' line ':' errmsg
  69.             END
  70.             else
  71.                 root = root':'
  72.  
  73.             sourcefile = file
  74.             /*    Strip off any leading directories: */
  75.             slash = lastpos('/',sourcefile)
  76.             if (slash > 0) then
  77.                 sourcefile = substr(sourcefile,slash+1)
  78.  
  79.             /*    Get current file's name: */
  80.             status 21
  81.             if upper(sourcefile) ~= upper(result) then
  82.             DO
  83.                 /* Find out how many views are displayed */
  84.                 status 66
  85.  
  86.                 /* Try to find the view containing the error file */
  87.                 DO numwins=result-1 to 1 by -1 until upper(result) = upper(sourcefile)
  88.                     next view
  89.                     /*    Get current file's name: */
  90.                     status 21
  91.                 END
  92.  
  93.                 /* If we can't find the file, then ask to open it */
  94.                 if upper(result) ~= upper(sourcefile) then
  95.                 DO
  96.                     next view        /* bring back to original view */
  97.                     okay2 "Error in line" line "of file" sourcefile || cr || errmsg || cr || "Bring it in?"
  98.                     if result = 1 then
  99.                     DO
  100.                         open new
  101.                         open root || file
  102.                     END
  103.                     else
  104.                     DO
  105.                         errorstr = readln('errfile')
  106.                         offset = seek('errfile',0,'C')
  107.                     END
  108.                 END
  109.             END
  110.  
  111.             /*    Get current file's name: */
  112.             status 21
  113.             if upper(sourcefile) = upper(result) then
  114.             DO
  115.                 /*    We want to put the cursor on the line containing the
  116.                     error.  Check if we're already there.  Get the current
  117.                     line (relative to first line = 0) */
  118.                 status 47
  119.  
  120.                 jumpto line 1
  121.  
  122.                 okay2 root || file':  Line' line || cr || errmsg || cr || 'Go to next error?'
  123.                 if result = 0 then
  124.                     done = 1
  125.                 else
  126.                 DO
  127.                     errorstr = readln('errfile')
  128.                     offset = seek('errfile',0,'C')
  129.                 END
  130.             END
  131.         END
  132.         else
  133.         DO
  134.             okay1 'No more errors.'
  135.             done = 1
  136.         END
  137.     END
  138.     call close 'errfile'
  139. END
  140. ELSE
  141.     OKAY1 'Error Messages not found.'
  142. exit
  143.